package com.zhaojiadi.singleton;

import java.util.Optional;

/**
 * @description:懒汉式，线程不安全
 */
public class Singleton_01 {
    private static Singleton_01 instance;

    private Singleton_01() {
    }

    public static Singleton_01 getInstance(){
        return Optional.ofNullable(instance).orElseGet(()->{
            instance = new Singleton_01();
            System.out.println("orElseGet被执行了！！！");
            return instance;
        });
    }

}
